package com.xci.sys.filter;

import com.xci.core.domain.BaseFilter;
import com.xci.core.helper.Helper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * 系统历史日志过滤条件
 *
 * @author 吕艳阳
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(description = "系统历史日志过滤条件")
public class HistoryLogFilter extends BaseFilter {
    /**
     * 操作类型 [新增_1,修改_2,删除_3]
     */
    @ApiModelProperty(value = "操作类型 [新增_1,修改_2,删除_3]", position = 1)
    private String category;

    /**
     * 操作类型数组
     */
    @ApiModelProperty(hidden = true)
    private String[] categorys;

    /**
     * 表名
     */
    @ApiModelProperty(value = "表名", position = 2)
    private String tableName;

    /**
     * 主键值
     */
    @ApiModelProperty(value = "主键值", position = 3)
    private String primaryKey;

    /**
     * 操作人姓名
     */
    @ApiModelProperty(value = "操作人姓名", position = 4)
    private String operateUserName;

    /**
     * 操作开始时间
     */
    @ApiModelProperty(value = "操作开始时间", position = 5)
    private Date operateStartDateTime;

    /**
     * 操作结束时间
     */
    @ApiModelProperty(value = "操作结束时间", position = 6)
    private Date operateEndDateTime;

    /**
     * 分割操作类型为数组
     */
    public void splitCategory() {
        if (Helper.isNotBlank(category)) {
            categorys = Helper.splitToArray(category);
        }
    }
}